<?php
/**
* VVBINH
* binhvuong@vietnambiz.com
*/
class login extends Controller{
	private $data = array();
	function login(){
		parent::Controller();
		$this->load->model('user_model');
		$this->load->library('Message');
	}
	
	function index(){
		
		//echo dirname($_SERVER['SCRIPT_FILENAME']);// Thu muc goc
		
		if($_SERVER['REQUEST_METHOD']=="POST"){
			$user = $this->input->post('txtUser');
			$pass = $this->input->post('txtPass');
			
			if($this->user_model->login($user,$pass)){
				redirect(base_url_admin('product_type'));
			}else{
				$this->data["err"]='Username or password is incorrect!';
			}
		}
		
		$this->load->view('login/index',$this->data);
	}
}